<template>

  <view class="components-list tn-safe-area-inset-bottom">

    <!-- 顶部自定义导航 -->
    <tn-nav-bar fixed>贷款合同</tn-nav-bar>

    <!-- 页面内容 -->
    <view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
      <demo-title v-for="(item, index) in records">
        <view class="tn-margin-top-sm">
			<tn-list-cell>
			  <view class="list-icon-text">
			    <view class="list__left">
			      <view class="list__left__text tn-color-black tn-text-bold">货物抵押贷款</view>
			    </view>
			    <view class="list__right" @click="tn(`/pages/loan/contract?id=${item.id}`)">
			      <view class="tn-text-sm tn-color-blue">查看详情</view>
			    </view>
			  </view>
			</tn-list-cell>
          <tn-list-cell>
            <view class="list-icon-text">
              <view class="list__left">
                <view class="list__left__text">贷款合同号</view>
              </view>
              <view class="list__right">
                <view class="tn-text-sm tn-color-gray">{{item.loanNo}}</view>
              </view>
            </view>
          </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款状态</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">正常</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款金额</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{item.loanAmount}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
		  <tn-list-cell>
		    <view class="list-icon-text">
		      <view class="list__left">
		        <view class="list__left__text">贷款期限</view>
		      </view>
		      <view class="list__right">
		        <view class="tn-text-sm tn-color-gray">{{item.loanStart}}至{{item.loanEnd}}</view>
		      </view>
		    </view>
		  </tn-list-cell>
        </view>
		</demo-title>
      
      <view class="tn-padding-bottom-lg"></view>

    </view>

  </view>

</template>

<script>
  import demoTitle from '@/libs/components/demo-title.vue'
    import {loanRecord} from '@/api/loan.js'
  export default {
    name: 'componentsList',
    components: {demoTitle},
    data() {
      return {
			records:[]
      }
    },
    watch: {

    },
	created() {
		this.record()
	},
    methods: {
		record(){
			loanRecord().then(res=>{
				this.records = res
			})
		},
      // 跳转
      tn(e) {
      	uni.navigateTo({
      		url: e,
      	});
      },
    }
  }
</script>

<style lang="scss" scoped>
  
  .components-list {
    background-color: $tn-bg-gray-color;
    min-height: 100vh;
  }
  
  .custom-title {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 10rpx 20rpx;
  }
  
  .list__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .list {
    &__left {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      
      &__icon, &__image {
        margin-right: 18rpx;
      }
    }
    
    &__right {
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }
  }
  
  .list-icon-text, .list-image-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .list-image-text {
    .list {
      &__left {
        &__image {
          width: 20rpx;
          height: 20rpx;
        }
      }
    }
  }
  
  .message {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    
    &__left {
      width: 10%;
    }
    &__middle {
      width: 80%;
      padding-left: 20rpx;
      padding-right: 40rpx;
    }
    &__right {
      width: 10%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }
    
    &__name {
      font-size: 32rpx;
      margin-bottom: 8rpx;
    }
    &__content {
      font-size: 26rpx;
      color: #838383;
    }
    &__tips {
      &__icon {
        font-size: 36rpx;
        color: #AAAAAA;
      }
    }
  }
</style>
